const express = require('express')
const provinceJson = require('./assets/json/province.json')
const cityJson = require('./assets/json/city.json')

const app = express()
var tmp = null
app.get("/api/city", (req, res) => {
  let citykeys = Object.keys(cityJson)
  for(let i = 0; i < provinceJson.length; i++) {
    for (let j = 0; j < citykeys.length; j++) {
      if (provinceJson[i].id === Number(citykeys[j])) {
        provinceJson[i]['children'] = cityJson[citykeys[j]]
      }
    }
  }
  res.send({ provinceJson })
})

const server = app.listen(80, 'localhost', () => {

})
